/**
 * 籌碼類
 * @author LuoDong
 * @email luo4521@online.net.tw
 * 2010-2-25 10:29
 */
package com.addcn.texas.utils
{
	import com.addcn.texas.utils.Chips;
	import flash.display.DisplayObject;
	import flash.display.Sprite;	
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.text.*;	
	
	import com.addcn.common.utils.AppLibary;
	import caurina.transitions.Tweener;
	
	public class  Pot extends Chips
	{		
		public static const MOVE_START : String = "moveStart";
		public static const MOVE_OVER : String = "moveOver";	
		private var _belong : int;
		private var _win_users : Array;		
		
		public function Pot(r_chip : int) : void {
			super(r_chip);
		}
		
		public function set winers(r_arr : Array) : void
		{
			this._win_users = r_arr;
		}
				
		public function set belong(r_sit :int) : void
		{
			this._belong = r_sit;
		}
		
		public function get belong() : int
		{
			return _belong;
		}
		
		public function get winers() : Array
		{
			return this._win_users;
		}
		
		/**
		 * 分割出筹码
		 * @param	r_chip int
		 */
		public function cut(r_chip:int):Pot 
		{		
			this.amount -= r_chip;			
			var _new_pot : Pot = new Pot(r_chip);
			_new_pot.show(this.parent);
			return _new_pot;
		}
		
		//移動籌碼
		override public function move(r_x:int, r_y:int):void 
		{
			
			setPosition(r_x, r_y);					
			Tweener.addTween(this, { x:r_x, y:r_y, time:0.7, delay : 0.3, transition:"easeOutSine" , onComplete:_complete } );		
		}
				
		private function _complete() : void
		{	
			Tweener.removeTweens(this, "x", "y");				
			remove();
			var _event : Event = new Event(Pot.MOVE_OVER);				
			dispatchEvent(_event);
						
		}
		
		
		
	}
	
}
